:root {
  --primary-color: #1E305E; /* Law Firm Blue */
  --secondary-color: #CD9D49; /* Law Firm Gold */
  --text-light: #f4f7f9;
  --text-dark: #333;
  --border-color: #e0e6ed;
  --success-bg: #d4edda;
  --success-text: #155724;
  --error-bg: #f8d7da;
  --error-text: #721c24;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f4f7f9;
  margin: 0;
  padding: 0;
  color: var(--text-dark);
}

/* -------------------- Login Page Styles -------------------- */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #CD9D49 50%, #1E305E 50%);
    background-size: cover;
    padding: 1rem;
    overflow-x: hidden;
    font-family: 'Poppins', sans-serif;
}

.login-container {
    text-align: center;
    max-width: 440px;   /* slightly wider */
    width: 100%;
}


.login-header {
    margin-bottom: 1rem;
}

.company-logo {
    height: 70px;
    width: auto;
    margin-bottom: 10px;
}

.login-form-card {
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 2.2rem 2rem;   /* more space inside */
    transition: transform 0.3s ease;
}

.login-form-card:hover {
    transform: translateY(-4px);
}

.form-title {
    font-size: 1.5rem;
    color: #1E305E;
    margin-bottom: 0.8rem;
    font-weight: 600;
    border-bottom: 2px solid #CD9D49;
    display: inline-block;
    padding-bottom: 5px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    text-align: left;
}

.form-group label {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.4rem;
    display: block;
}

.form-group input {
    width: 100%;
    padding: 14px;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 1rem;
    transition: 0.3s ease;
}

.form-group input:focus {
    border-color: #1E305E;
    box-shadow: 0 0 0 4px rgba(30, 48, 94, 0.1);
    outline: none;
}

/* Password toggle */
.password-group {
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
}

/* Button */
.login-btn {
    background: linear-gradient(135deg, #CD9D49, #B8860B);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: linear-gradient(135deg, #B8860B, #CD9D49);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(205, 157, 73, 0.3);
}

/* Error message */
.error-message {
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background-color: #ffefef;
    color: #b32626;
    border: 1px solid #e4a5a5;
    font-size: 0.9rem;
}

/* Footer note */
.login-footer-note {
    margin-top: 2rem;
    font-size: 0.85rem;
    text-align: center;
    color: #CD9D49;
    opacity: 0.85;
}

.login-footer-note p {
    margin: 0;
}


/* Base Styles for Buttons and Inputs */
button, .btn, .btn-action, input[type="text"], input[type="password"], input[type="date"], input[type="file"], select, textarea {
  border-radius: 6px;
  box-sizing: border-box;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Buttons */
button, .btn, .btn-action {
  display: inline-block;
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-weight: bold;
  margin-top: 6px;
  margin-bottom: 5px;
}

button, .btn {
  background-color: var(--primary-color);
  color: var(--text-light);
  padding: 12px 24px;
  font-size: 1rem;
}

button:hover, .btn:hover {
  background-color: var(--secondary-color);
}

.btn-danger {
  background-color: #d32f2f;
}

.btn-secondary {
  background-color: #555;
}

.dashboard-actions, .actions-group, .search-form {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2rem;
}

.dashboard-actions {
  justify-content: flex-end;
  gap: 15px;
}

.actions-group {
  justify-content: flex-end;
  margin-top: 2rem;
}

/* Inputs and Textareas */
input[type="text"], input[type="password"], input[type="date"], input[type="file"], select, textarea {
  width: 100%;
  padding: 15px;
  margin-bottom: 6px;
  padding: 15px;
  border: 1px solid var(--border-color);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-color);
  outline: none;
}

/* Header and Navigation */
header {
  background-color: var(--secondary-color);
  color: var(--text-dark);
  padding: 1rem 2rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

header .logo img {
  height: 50px;
  width: auto;
  display: block;
}

header nav a {
  color: var(--text-dark);
  margin-left: 1.5rem;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

header nav a:hover {
  color: var(--primary-color);
}

/* Main Layout and Containers */
main {
  padding: 2rem 0;
}

.container {
  margin: 0 auto;
  padding: 2rem;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.login-container {
  max-width: 450px;
  margin: 5rem auto;
  padding: 2.5rem;
}

/* Typography and Headings */
h2 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}

/* Messages */
.success-message, .error-message {
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-weight: bold;
}

.success-message {
  background-color: var(--success-bg);
  color: var(--success-text);
}

.error-message {
  background-color: var(--error-bg);
  color: var(--error-text);
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
    min-width: 600px;
  border-collapse: collapse;
  margin-top: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

table th, table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

table th {
  background-color: var(--primary-color);
  color: var(--text-light);
  font-weight: 600;
}

table tr:nth-child(even) {
  background-color: #f9fbfd;
}

table tr:hover {
  background-color: #eef2f5;
}

/* File Details and Forms */
.file-details-container {
  padding: 3rem;
}

.details-grid, .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem 3rem;
  margin-bottom: 2rem;
}

.form-grid {
  gap: 1.5rem;
}

.detail-item, .form-group {
  display: flex;
  flex-direction: column;
}

.detail-item strong, .form-group label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.detail-item span, .detail-item p {
  font-size: 1rem;
  color: var(--text-dark);
  line-height: 1.5;
  margin: 0;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
}

.full-width {
  grid-column: 1 / -1;
}

.current-file {
  margin: 0.5rem 0 0.5rem 0;
  font-size: 0.9em;
  color: #555;
}

/* New style for form action buttons */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Action Buttons in Tables */
.btn-action {
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.9em;
  margin-right: 5px;
}

.btn-action.view {
  background-color: var(--primary-color);
  color: var(--text-light);
}

.btn-action.view:hover {
  background-color: #1a274a;
}

.btn-action.edit {
  background-color: var(--secondary-color);
  color: var(--text-light);
}

.btn-action.edit:hover {
  background-color: #a7813a;
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    margin: auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: fadeIn 0.3s ease-in-out;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-body {
  padding-bottom: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-btn:hover,
.close-btn:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Status Modal Styles */
.modal-content.success {
    border-top: 5px solid var(--success-text);
}

.modal-content.error {
    border-top: 5px solid var(--error-text);
}

#statusModalTitle {
    color: var(--primary-color);
}

/* Container for the table-like structure */
.file-table-container {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden; /* Ensures borders are rounded at corners */
    margin-top: 15px;
    background-color: #f8f9fa;
}

/* Header for the table, with a clear, dark background */
.file-table-header {
    display: grid;
    grid-template-columns: 3fr 1fr;
    padding: 12px 20px;
    font-weight: bold;
    color: #ffffff;
    background-color: #343a40; /* Darker background for contrast */
}

/* Individual table row for each file */
.file-table-row {
    display: grid;
    grid-template-columns: 3fr 1fr;
    align-items: center;
    padding: 15px 20px;
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

/* Alternate row color for better readability */
.file-table-row:nth-child(even) {
    background-color: #f1f3f5;
}

.file-table-row:hover {
    background-color: #e9ecef;
}

.file-table-row:last-child {
    border-bottom: none;
}

/* File name and icon cell */
.file-name-cell {
    display: flex;
    align-items: center;
    overflow: hidden;
}

.file-icon {
    font-size: 1.2rem;
    color: #6c757d;
    margin-right: 15px;
}

.file-name {
    font-weight: 500;
    color: #495057;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-name:hover {
    text-decoration: underline;
    color: #007bff;
}

/* Actions cell */
.file-actions-cell {
    display: flex;
    justify-content: flex-end; /* Aligns actions to the right */
    gap: 10px;
}

/* Button styling for consistency */
.edit-btn-action {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-decoration: none;
    color: white;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-action:hover {
    transform: scale(1.1);
}

.download-btn {
    background-color: #28a745; /* Green */
}

.download-btn:hover {
    background-color: #218838;
}

.delete-btn {
    background-color: #dc3545; /* Red */
}

.delete-btn:hover {
    background-color: #c82333;
}

/* Alert Styles */
.alert {
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* Added for subtle depth */
}

.alert-success {
  background-color: #d4edda; /* Light green background */
  color: #155724; /* Dark green text */
  border: 1px solid #c3e6cb; /* Green border */
}

.alert-danger {
  background-color: #f8d7da; /* Light red background */
  color: #721c24; /* Dark red text */
  border: 1px solid #f5c6cb; /* Red border */
}

.alert .alert-icon {
  font-size: 1.5rem;
  /* Ensure the icon color matches the text for consistency */
  color: inherit; 
}

/* Footer */
footer {
  background-color: var(--primary-color);
  color: var(--text-light);
  padding: 1rem 2rem;
  text-align: center;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  margin-top: auto;
}

/* --- Mobile-First Adjustments --- */

.mobile-card-row {
    display: none; /* Mobile card is hidden by default on all screens */
}

/* New CSS to style the mobile cards */
.mobile-card {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.card-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.card-group:last-child {
    border-bottom: none;
}

.card-label {
    font-weight: bold;
    color: var(--primary-color);
}

.card-value {
    text-align: right;
    color: var(--text-dark);
}

.card-actions {
    display: flex;
    justify-content: space-around;
    gap: 0.5rem;
    margin-top: 1rem;
}



/* Media Queries for Responsiveness */

/* Styles for screens smaller than 768px (Mobile) */
@media (max-width: 768px) {
    .login-form-card {
      padding: 1.5rem;
    }
    .form-title {
      font-size: 1.3rem;
    }
    
    /* Hide the normal table rows on mobile screens */
    .file-entry {
        display: none;
    }
    
    /* Show the mobile card view */
    .mobile-card-row {
        display: table-row; /* Change from 'none' to 'table-row' to make it visible */
    }

    /* Override table display for the mobile cards */
    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead {
        display: none;
    }
    
    tr {
        margin-bottom: 1rem;
    }

    /* The td will be used as a container for the mobile-card */
    .mobile-card-row td {
        padding: 0;
        border-bottom: none;
    }

}

/* Media Queries for Responsiveness */

/* Extra Large devices (desktops, 1200px and up) */
@media (min-width: 1200px) {
  .container, .login-container {
    max-width: 1140px;
  }
}

/* Large devices (laptops and desktops, 992px and up) */
@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  .container {
    max-width: 880px;
  }
}

/* Styles for screens smaller than 768px (Mobile) */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  .container, .file-details-container, .login-container {
    padding: 1rem;
  }
  
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  header nav {
    margin-top: 0.5rem;
    width: 100%;
    text-align: center;
  }
  
  header nav a {
    margin: 0 0.5rem;
  }

  .details-grid, .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .full-width {
    grid-column: auto;
  }
  
  .dashboard-actions, .actions-group, .search-form {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  
  .dashboard-actions .btn {
    width: 100%;
    text-align: center;
  }
  
  /* Hide the normal table on mobile screens */
    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        margin: 0 0 1rem 0;
        border: 1px solid var(--border-color);
        border-radius: 6px;
    }

    td {
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding-left: 50%;
        text-align: right;
    }

    td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 50%;
        padding-left: 15px;
        font-weight: bold;
        text-align: left;
    }

    .btn-action {
        margin-right: 0;
        margin-top: 5px;
    }

}

@media (max-width: 480px) {
  .container, .file-details-container {
    padding: 1rem 0.5rem;
  }
  
  .login-container {
    margin: 2rem 1rem;
  }
  
  header {
    padding: 1rem;
  }

  h2 {
    font-size: 1.5rem;
  }
}