/* ============================================
   المهندس علاء - Main Stylesheet
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    direction: rtl;
    font-size: 16px;
}

body {
    font-family: 'Tajawal', 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #F3F4F6 0%, #FFFFFF 100%);
    color: #1F2937;
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   HOMEPAGE STYLES
   ============================================ */

.homepage-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.homepage-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
    padding: 40px;
}

.homepage-title {
    font-size: 32px;
    font-weight: 700;
    color: #1F2937;
    text-align: center;
    margin-bottom: 30px;
}

.homepage-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ============================================
   FORM STYLES
   ============================================ */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 14px;
    font-weight: 600;
    color: #1F2937;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
    padding: 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: white;
    color: #1F2937;
    transition: 0.3s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   BUTTON STYLES
   ============================================ */

button,
.btn-primary,
.btn-secondary,
.btn-logout {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s ease;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #7C3AED 0%, #3B82F6 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #E5E7EB;
    color: #1F2937;
}

.btn-secondary:hover {
    background: #D1D5DB;
}

.btn-logout {
    background: #EF4444;
    color: white;
    padding: 10px 16px;
    font-size: 14px;
}

.btn-logout:hover {
    opacity: 0.9;
}

.btn-full {
    width: 100%;
}

.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.form-buttons button,
.form-buttons a {
    flex: 1;
}

/* ============================================
   MESSAGE STYLES
   ============================================ */

.error-message,
.error {
    background: #FEE2E2;
    color: #991B1B;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #FECACA;
}

.success-message,
.success {
    background: #ECFDF5;
    color: #065F46;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #A7F3D0;
}

/* ============================================
   PROJECT CONTAINER STYLES
   ============================================ */

.project-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #E5E7EB;
}

.project-header h1 {
    font-size: 28px;
    color: #1F2937;
}

/* ============================================
   CARDS GRID STYLES
   ============================================ */

.cards-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 30px;
}

.cards-grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Updated card styles for responsive large numbers */

.cards-grid-5 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.card {
    background: white;
    border: none;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid #3B82F6;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
}

.card::before {
    display: none;
}

/* Card value color variants for screen */
.card-value-green {
    color: #10B981 !important;
}

.card-value-red {
    color: #EF4444 !important;
}

.card-value-purple {
    color: #7C3AED !important;
}

.card-value-balance,
.card-value-due {
    color: inherit;
}

.card:hover {
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
}

.card-label {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

.card-value {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #1F2937 0%, #374151 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    word-break: break-word;
    line-height: 1.3;
}

.card-interpretation {
    font-size: 12px;
    color: #6B7280;
    margin-top: 8px;
    line-height: 1.4;
    padding-top: 8px;
    border-top: 1px solid #F3F4F6;
    word-break: break-word;
}

/* Responsive adjustments for large numbers */
@media (max-width: 768px) {
    .cards-grid-5 {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
    
    .card {
        padding: 16px;
        min-height: 120px;
    }
    
    .card-value {
        font-size: 16px;
    }
    
    .card-label {
        font-size: 11px;
    }
    
    .card-interpretation {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .cards-grid-5 {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 16px;
        min-height: auto;
    }
    
    .card-value {
        font-size: 16px;
    }
    
    .card-label {
        font-size: 12px;
    }
    
    .card-interpretation {
        font-size: 12px;
    }
}
/* ============================================
   TRANSACTIONS SECTION STYLES
   ============================================ */

.transactions-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #E5E7EB;
}

.table-responsive {
    overflow-x: auto;
}

.transactions-table,
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.transactions-table thead,
.data-table thead {
    background: #F3F4F6;
}

.transactions-table th,
.data-table th {
    padding: 12px;
    text-align: right;
    font-weight: 600;
    color: #1F2937;
    border-bottom: 1px solid #E5E7EB;
}

.transactions-table td,
.data-table td {
    padding: 12px;
    border-bottom: 1px solid #E5E7EB;
}

.transactions-table tbody tr,
.data-table tbody tr {
    transition: 0.2s ease;
}

.transactions-table tbody tr:hover,
.data-table tbody tr:hover {
    background: #F9FAFB;
}

.income-row {
    background: #ECFDF5;
}

.expense-row {
    background: #FEF2F2;
}

.details-cell {
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    max-width: 300px;
    line-height: 1.5;
}

/* ============================================
   EMPTY STATE STYLES
   ============================================ */

.empty-state {
    background: #F9FAFB;
    border: 2px dashed #E5E7EB;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    color: #6B7280;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 16px;
}

/* ============================================
   ACTION BUTTONS STYLES
   ============================================ */

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.action-buttons button,
.action-buttons a {
    flex: 1;
    min-width: 150px;
}

.actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #F3F4F6;
    color: #1F2937;
    text-decoration: none;
    transition: 0.2s ease;
    font-size: 16px;
}

.action-link:hover {
    background: #E5E7EB;
}

/* ============================================
   ADMIN CONTAINER STYLES
   ============================================ */

.admin-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: #1F2937;
    color: white;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: 0.2s ease;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: #3B82F6;
    color: white;
}

.nav-item.logout {
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    color: #EF4444;
}

.admin-main {
    flex: 1;
    margin-right: 250px;
    padding: 30px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #E5E7EB;
}

.admin-header h1 {
    font-size: 28px;
    color: #1F2937;
}

.user-info {
    font-size: 14px;
    color: #6B7280;
}

.admin-form {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 600px;
}

.admin-form .form-group {
    margin-bottom: 20px;
}

.form-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.form-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #1F2937;
}

.section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.password-mask {
    color: #9CA3AF;
    letter-spacing: 2px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .admin-main {
        margin-right: 0;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .sidebar-header {
        margin-bottom: 0;
        border-bottom: none;
    }
    
    .sidebar-nav {
        flex-direction: row;
        gap: 4px;
    }
    
    .nav-item {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .cards-grid-4,
    .cards-grid-5 {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .homepage-card {
        padding: 24px;
    }
    
    .homepage-title {
        font-size: 24px;
    }
    
    .project-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .project-header h1 {
        font-size: 20px;
    }
    
    .cards-grid-4,
    .cards-grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .card {
        padding: 16px;
    }
    
    .card-value {
        font-size: 18px;
    }
    
    .admin-main {
        padding: 16px;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .admin-header h1 {
        font-size: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons button,
    .action-buttons a {
        width: 100%;
    }
    
    .table-responsive {
        font-size: 12px;
    }
    
    .transactions-table th,
    .data-table th,
    .transactions-table td,
    .data-table td {
        padding: 8px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 14px;
    }
    
    .homepage-card {
        padding: 20px;
    }
    
    .homepage-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px;
    }
    
    button,
    .btn-primary,
    .btn-secondary {
        padding: 12px 16px;
        font-size: 14px;
        height: 44px;
    }
    
    .cards-grid-4,
    .cards-grid-5 {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 12px;
    }
    
    .card-label {
        font-size: 11px;
    }
    
    .card-value {
        font-size: 16px;
    }
    
    .section-title {
        font-size: 16px;
    }
    
    .sidebar {
        flex-direction: column;
        gap: 12px;
    }
    
    .sidebar-nav {
        flex-direction: column;
        gap: 4px;
    }
    
    .nav-item {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .admin-main {
        padding: 12px;
    }
    
    .admin-header h1 {
        font-size: 18px;
    }
    
    .form-section,
    .section {
        padding: 16px;
    }
    
    .empty-state {
        padding: 24px;
    }
    
    .table-responsive {
        font-size: 11px;
    }
    
    .transactions-table th,
    .data-table th,
    .transactions-table td,
    .data-table td {
        padding: 6px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body {
        background: white;
        color: #000;
    }
    
    .project-header,
    .action-buttons,
    .sidebar,
    .admin-header {
        display: none;
    }
    
    .project-container {
        max-width: 100%;
        padding: 0;
    }
    
    .card,
    .section {
        box-shadow: none;
        border: 1px solid #E5E7EB;
    }
    
    /* Hide decorative elements in print */
    .card::before,
    .card::after {
        display: none !important;
    }
    
    /* Ensure cards print cleanly */
    .card {
        page-break-inside: avoid;
        background: white;
    }
    
    /* Make card values visible in print */
    .card-value,
    .card-value-green,
    .card-value-red,
    .card-value-purple,
    .card-value-balance,
    .card-value-due {
        background: none !important;
        -webkit-background-clip: unset !important;
        -webkit-text-fill-color: #000 !important;
        background-clip: unset !important;
        color: #000 !important;
        font-size: 16px !important;
    }
    
    /* Ensure text is visible */
    .card-label,
    .card-interpretation {
        color: #000 !important;
    }
}
