:root {
    --primary: #1a73e8;
    --secondary: #185abc;
    --danger: #d93025;
    --danger-hover: #c5221f;
    --bg: #f0f2f5;
    --text: #333;
    --border: #e0e0e0;
    --success: #e6f4ea;
    --error: #fce8e6;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --font: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: linear-gradient(135deg, #f5f7fa 0%, #e4ebf1 100%);
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    text-align: center;
}

h1, h2 { font-size: 26px; color: var(--primary); margin-bottom: 10px; }
p { color: var(--text); font-size: 15px; margin-bottom: 24px; }

input[type="text"], input[type="password"] {
    width: 100%; padding: 12px 15px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 15px; margin-bottom: 16px; background: #fff; transition: 0.2s;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,0.2); }

.btn {
    border: none; border-radius: 8px; padding: 12px 18px; font-size: 15px;
    font-weight: 500; cursor: pointer; transition: 0.3s; text-decoration: none; display: inline-block; text-align: center;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--secondary); }
.btn-primary:disabled { background-color: #e0e0e0; color: #999; cursor: not-allowed; }

.form-row { display: flex; align-items: center; gap: 10px; }
.file-input-wrapper { flex-grow: 1; position: relative; }
.file-input-label {
    display: block; padding: 12px 15px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; color: #888; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-input-wrapper input[type="file"] { display: none; }

.status-box { margin-top: 20px; padding: 14px; border-radius: 8px; font-size: 14px; display: none; }
.status-success { background-color: var(--success); border: 1px solid #b7e4b6; color: #1e8e3e; display: block; }
.status-error { background-color: var(--error); border: 1px solid #f9ab9f; color: #d93025; display: block; }
.progress-container { width: 100%; background-color: #e0e0e0; border-radius: 4px; margin-top: 16px; display: none; }
.progress-bar { width: 0%; height: 8px; background-color: var(--primary); border-radius: 4px; transition: width 0.3s ease; }

a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
.logo { width: 120px; height: auto; border-radius: 0; object-fit: contain; display: block; margin: 0 auto 20px auto; }

/* --- DASHBOARD LAYOUT --- */
body.dashboard-page { align-items: flex-start; padding: 0; }
.dashboard-container { display: flex; gap: 40px; width: 100%; max-width: 1200px; padding: 40px; margin: 0 auto; }
.dashboard-left, .dashboard-right { background: rgba(255,255,255,0.8); backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px; }
.dashboard-left { flex: 1; min-width: 400px; align-self: flex-start; }
.dashboard-right { flex: 1.5; display: flex; flex-direction: column; overflow-y: auto; height: calc(100vh - 80px); }

.header-bar { display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.header-bar h1 { margin:0; font-size: 24px; }
h2 { font-size: 22px; color: #333; margin-top: 0; padding-bottom: 16px; margin-bottom: 24px; }
.document-list { list-style: none; padding: 0; margin: 0; }
.document-list-item { display: flex; align-items: center; background-color: #fff; padding: 16px; border-radius: 8px; margin-bottom: 12px; border: 1px solid #f0f0f0; }
.document-icon { font-size: 24px; margin-right: 16px; color: var(--text); }
.document-details { flex-grow: 1; text-align: left; overflow: hidden; }
.document-title { font-weight: 500; color: #333; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.document-meta { font-size: 13px; color: #777; }
.document-actions { display: flex; align-items: center; margin-left: auto; } /* Keep buttons on the right */
.document-actions .btn { font-size: 14px; padding: 6px 12px; }
.btn-view { background-color: #f1f3f4; color: var(--primary); }
.btn-view:hover { background-color: #e8f0fe; text-decoration: none; }
.btn-delete { background-color: var(--danger); color: white; margin-left: 8px; }
.btn-delete:hover { background-color: var(--danger-hover); }

/* --- MOBILE RESPONSIVE FIXES --- */
/* --- MOBILE RESPONSIVE FIXES (IMPROVED) --- */
@media (max-width: 900px) {
    html, body {
        width: 100%;
        overflow-x: hidden; /* Prevent horizontal scroll */
    }

    body.dashboard-page {
        align-items: stretch;
        justify-content: flex-start;
        padding: 0;
    }

    .dashboard-container {
        flex-direction: column;
        gap: 0;
        padding: 0;
        margin: 0;
        width: 100%;
        max-width: 100%; /* Remove the 1200px limit */
    }

    .dashboard-left, .dashboard-right {
        width: 100%;
        border-radius: 0;
        box-shadow: none;
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        padding: 24px 16px; /* smaller padding for mobile */
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
    }

    .dashboard-right {
        overflow-y: visible;
        height: auto;
    }

    .document-list-item {
        flex-wrap: wrap;
        width: 100%;
    }

    .document-details {
        width: 100%;
        margin-bottom: 16px;
    }

    .document-actions {
        margin-left: auto;
    }

    /* Fix upload form stacking */
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row .btn {
        width: 100%;
    }

    .file-input-wrapper {
        margin-bottom: 10px;
    }
}
/* --- DOCUMENT LIST STYLING (UPDATED) --- */
.document-list-item {
    display: flex;
    flex-wrap: wrap; /* Allows items to wrap to the next line */
    align-items: center;
    background-color: #fff;
    padding: 16px;
    border-radius: 12px; /* A bit more rounded */
    margin-bottom: 12px;
    border: 1px solid #f0f0f0;
}

.document-icon {
    font-size: 32px; /* Slightly larger icon */
    margin-right: 16px;
    color: var(--text);
}

.document-details {
    flex-grow: 1;
    text-align: left;
    overflow: hidden;
}
/* ... other document-details styles are fine ... */

/* --- THIS IS THE KEY FIX FOR THE BUTTONS --- */
.document-actions {
    /* Make the container take up the full width on a new line */
    flex-basis: 100%;
    margin-top: 16px; /* Add space above the buttons */
    padding-top: 16px; /* Add more space and a line */
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end; /* Align buttons to the right */
    align-items: center;
    gap: 8px; /* Space between buttons */
}

/* Ensure all buttons in the actions have the same height */
.document-actions .btn {
    font-size: 14px;
    padding: 8px 16px; /* Adjust padding for consistent height */
    white-space: nowrap; /* Prevent text from wrapping on buttons */
}
