/* Custom CSS for EduTips */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --info-color: #0891b2;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-muted: #64748b;
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --gradient-secondary: linear-gradient(135deg, #64748b 0%, #475569 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--light-color);
    color: var(--dark-color);
    margin: 0;
    padding: 0;
}

.main-content {
    min-height: calc(100vh - 200px);
    padding: 3rem 0;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--gradient-primary);
    color: white;
    margin: 0 0 4rem 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="white" opacity="0.1"><polygon points="0,0 1000,0 1000,100 0,80"/></svg>') no-repeat bottom;
    background-size: cover;
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -0.025em;
}

.hero-description {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 700px;
    margin: 0 auto;
    font-weight: 400;
}

/* Tool Cards */
.tools-grid {
    padding: 2rem 0;
}

.tool-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.tool-card-header {
    height: 200px;
    background: var(--gradient-primary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tool-card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%), 
                linear-gradient(-45deg, rgba(255,255,255,0.1) 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.1) 75%), 
                linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.1) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    opacity: 0.3;
}

.tool-icon {
    position: relative;
    z-index: 2;
}

.tool-image {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.tool-card-body {
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tool-card h3 {
    color: var(--dark-color);
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.3;
}

.tool-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    flex-grow: 1;
    font-size: 1rem;
    line-height: 1.6;
}

.btn {
    border-radius: 12px;
    padding: 0.875rem 2rem;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.025em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
}

/* Tool Page Styles */
.tool-header {
    background: var(--gradient-primary);
    color: white;
    padding: 3rem 0;
    margin-bottom: 3rem;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
}

.tool-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" fill="white" opacity="0.1"><polygon points="0,0 1000,0 1000,100 0,80"/></svg>') no-repeat bottom;
    background-size: cover;
}

.tool-header .container {
    position: relative;
    z-index: 1;
}

.tool-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.tool-header p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin: 0;
}

.calculator-form {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 3rem;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 2rem;
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.75rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-control {
    border-radius: 12px;
    border: 2px solid var(--border-color);
    padding: 1rem 1.25rem;
    transition: all 0.3s ease;
    font-size: 1rem;
    background-color: var(--card-bg);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.form-control:hover {
    border-color: var(--primary-color);
}

.result-card {
    background: var(--gradient-primary);
    color: white;
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    margin-top: 3rem;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%), 
                linear-gradient(-45deg, rgba(255,255,255,0.1) 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.1) 75%), 
                linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.1) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    opacity: 0.3;
}

.result-card > * {
    position: relative;
    z-index: 1;
}

.result-value {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.result-label {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 500;
}

.grade-display {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Subject Input Styles */
.subject-row {
    background: var(--light-color);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.subject-row:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.subject-row .form-control {
    margin-bottom: 1rem;
}

.add-subject-btn {
    background: var(--success-color);
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    margin-top: 0;
}

.add-subject-btn:hover {
    background: #047857;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.remove-subject-btn {
    background: var(--danger-color);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: white;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.remove-subject-btn:hover {
    background: #b91c1c;
    transform: scale(1.05);
}

/* Align buttons with input fields in subject rows */
.subject-row .col-md-2 .d-flex {
    margin-top: 0;
}

/* For the first row with labels, align button with input field */
.subject-row:first-child .add-subject-btn {
    margin-top: 0;
}

/* For dynamically added rows without labels, align button with input field */
.subject-row:not(:first-child) .remove-subject-btn {
    margin-top: 0;
}

/* Card Improvements */
.card {
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: 2rem;
}

.card-title {
    color: var(--dark-color);
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Progress Bar */
.progress {
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.progress-bar {
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* Table Improvements */
.table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead th {
    background: var(--light-color);
    border: none;
    font-weight: 600;
    color: var(--dark-color);
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    border-color: var(--border-color);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(248, 250, 252, 0.5);
}

/* Badge Improvements */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Footer */
.footer {
    margin-top: auto;
}

.footer h5, .footer h6 {
    color: var(--light-color);
    margin-bottom: 1rem;
}

.footer a:hover {
    color: var(--primary-color) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 1rem;
    }
    
    .hero-section h1 {
        font-size: 2.25rem;
    }
    
    .hero-description {
        font-size: 1.1rem;
    }
    
    .main-content {
        padding: 2rem 0;
    }
    
    .tool-card-header {
        height: 160px;
    }
    
    .tool-image {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .tool-card-body {
        padding: 1.5rem;
    }
    
    .tool-card h3 {
        font-size: 1.25rem;
    }
    
    .calculator-form {
        padding: 2rem 1.5rem;
    }
    
    .tool-header {
        padding: 2rem 0;
        margin-bottom: 2rem;
    }
    
    .tool-header h1 {
        font-size: 2rem;
    }
    
    .result-card {
        padding: 2rem 1.5rem;
    }
    
    .result-value {
        font-size: 2.5rem;
    }
}

@media (max-width: 576px) {
    .hero-section h1 {
        font-size: 1.875rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .tool-card-header {
        height: 140px;
    }
    
    .tool-image {
        width: 50px;
        height: 50px;
        font-size: 1.75rem;
    }
    
    .calculator-form {
        padding: 1.5rem 1rem;
    }
    
    .result-value {
        font-size: 2rem;
    }
    
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .btn-lg {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }
}

/* Additional Spacing Utilities */
.section-spacing {
    padding: 4rem 0;
}

.card-spacing {
    margin-bottom: 2rem;
}

.form-spacing {
    margin-bottom: 1.5rem;
}

/* Enhanced Focus States */
.btn:focus,
.form-control:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Improved Hover States */
.tool-card:hover .tool-card-header {
    transform: scale(1.02);
}

.tool-card-header {
    transition: transform 0.3s ease;
}

/* Better Typography */
.display-1 {
    font-weight: 800;
    letter-spacing: -0.025em;
}

.display-2 {
    font-weight: 700;
    letter-spacing: -0.025em;
}

.lead {
    font-weight: 400;
    color: var(--text-muted);
}

/* Enhanced Navbar */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover {
    transform: translateY(-1px);
}

.dropdown-menu {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    min-width: 250px;
}

.dropdown-header {
    padding: 0.75rem 1.5rem 0.5rem 1.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    background-color: #f8fafc;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
    transform: translateX(5px);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    opacity: 0.7;
}

.dropdown-item:hover i {
    opacity: 1;
    color: var(--primary-color);
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-top: 1px solid var(--border-color);
}

/* Navbar dropdown improvements */
.navbar .dropdown-menu {
    margin-top: 0.5rem;
    animation: dropdownFadeIn 0.3s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}