/* ============ RESPONSIVE STYLES ============ */

/* ============ TABLET & SMALLER SCREENS ============ */
@media (max-width: 1024px) {
    .cv-builder-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .form-panel {
        max-height: none;
        overflow-y: visible;
    }

    .preview-panel {
        position: relative;
        top: 0;
        max-height: none;
        overflow-y: visible;
        order: -1;
    }

    .preview-panel .cv-preview {
        min-height: 400px;
    }
}

/* ============ MOBILE SCREENS ============ */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    /* Header */
    .header-content {
        flex-direction: row;
        justify-content: space-between;
    }

    .logo {
        font-size: 20px;
    }

    .logo i {
        font-size: 22px;
    }

    /* Welcome Screen */
    .welcome-content h1 {
        font-size: 32px;
    }

    .welcome-content p {
        font-size: 16px;
    }

    .welcome-actions {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .welcome-actions .btn-primary,
    .welcome-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .welcome-features {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .welcome-icon {
        font-size: 60px;
    }

    /* Form */
    .form-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .form-header h2 {
        font-size: 18px;
    }

    .form-actions {
        flex-direction: column;
        gap: 8px;
    }

    .btn-preview,
    .btn-download {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .form-section {
        margin-bottom: 20px;
    }

    .section-title {
        font-size: 16px;
    }

    .form-input,
    .form-textarea {
        padding: 10px 14px;
        font-size: 13px;
    }

    .education-item,
    .internship-item,
    .work-item,
    .organization-item,
    .project-item,
    .certification-item,
    .skill-category-item {
        padding: 14px;
    }

    .btn-remove-edu,
    .btn-remove-int,
    .btn-remove-work,
    .btn-remove-org,
    .btn-remove-project,
    .btn-remove-cert,
    .btn-remove-skill {
        position: relative;
        top: auto;
        right: auto;
        margin-top: 8px;
        width: 100%;
        justify-content: center;
        background: #fee2e2;
    }

    .btn-remove-edu:hover,
    .btn-remove-int:hover,
    .btn-remove-work:hover,
    .btn-remove-org:hover,
    .btn-remove-project:hover,
    .btn-remove-cert:hover,
    .btn-remove-skill:hover {
        background: #fecaca;
    }

    body.dark-theme .btn-remove-edu,
    body.dark-theme .btn-remove-int,
    body.dark-theme .btn-remove-work,
    body.dark-theme .btn-remove-org,
    body.dark-theme .btn-remove-project,
    body.dark-theme .btn-remove-cert,
    body.dark-theme .btn-remove-skill {
        background: #450a0a;
    }

    body.dark-theme .btn-remove-edu:hover,
    body.dark-theme .btn-remove-int:hover,
    body.dark-theme .btn-remove-work:hover,
    body.dark-theme .btn-remove-org:hover,
    body.dark-theme .btn-remove-project:hover,
    body.dark-theme .btn-remove-cert:hover,
    body.dark-theme .btn-remove-skill:hover {
        background: #7f1d1d;
    }

    /* Preview */
    .preview-panel {
        padding: 16px;
    }

    .preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .preview-header h2 {
        font-size: 18px;
    }

    .cv-preview {
        padding: 16px;
        min-height: 350px;
    }

    /* Preview Content - Mobile */
    .preview-header-main h1 {
        font-size: 20px !important;
    }

    .preview-header-main .preview-position {
        font-size: 12px !important;
    }

    .preview-contact-row {
        font-size: 11px !important;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .preview-contact-row span,
    .preview-contact-row a {
        display: block;
        text-align: center;
    }

    .preview-section-title {
        font-size: 14px !important;
    }

    .preview-about {
        font-size: 12px !important;
    }

    .preview-education-item .edu-header,
    .preview-exp-item .exp-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .preview-education-item .edu-institution,
    .preview-exp-item .exp-company {
        font-size: 13px !important;
    }

    .preview-education-item .edu-major,
    .preview-exp-item .exp-position {
        font-size: 12px !important;
    }

    .preview-education-item .edu-meta,
    .preview-exp-item .exp-meta {
        font-size: 11px !important;
    }

    .preview-exp-item .exp-description {
        font-size: 12px !important;
        padding-left: 8px;
    }

    .preview-project-item .project-name {
        font-size: 13px !important;
    }

    .preview-project-item .project-desc {
        font-size: 12px !important;
    }

    .preview-project-item .project-tech {
        font-size: 11px !important;
    }

    .preview-skills-categories {
        gap: 8px;
    }

    .preview-skill-category {
        padding: 8px 10px;
    }

    .preview-skills-list {
        gap: 4px;
    }

    .preview-skill-tag {
        font-size: 11px !important;
        padding: 2px 8px !important;
    }

    /* Certificate */
    .cert-upload-area {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 16px;
    }

    .cert-preview {
        width: 100px;
        height: 100px;
    }

    .cert-upload-controls {
        align-items: center;
        width: 100%;
    }

    .btn-upload-cert,
    .btn-remove-cert-image {
        width: 100%;
        justify-content: center;
    }

    .preview-cert-image {
        max-width: 100%;
    }

    .preview-cert-image img {
        max-height: 120px;
    }

    /* Toast */
    .toast {
        min-width: auto;
        width: 90%;
        margin: 0 auto;
        padding: 14px 18px;
        font-size: 14px;
    }

    .toast-container {
        right: 10px;
        left: 10px;
        top: 10px;
    }

    /* Footer */
    .app-footer {
        font-size: 12px;
        padding: 16px 0;
        margin-top: 20px;
    }

    /* Optional badges */
    .optional-badge {
        font-size: 10px;
        padding: 1px 8px;
    }
}

/* ============ SMALL MOBILE SCREENS ============ */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .welcome-content h1 {
        font-size: 26px;
    }

    .welcome-icon {
        font-size: 48px;
    }

    .welcome-content p {
        font-size: 14px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 12px 20px;
        font-size: 14px;
    }

    .form-panel,
    .preview-panel {
        padding: 14px;
    }

    .form-header h2 {
        font-size: 16px;
    }

    .section-title {
        font-size: 15px;
    }

    .form-input,
    .form-textarea {
        padding: 8px 12px;
        font-size: 12px;
    }

    .form-group label {
        font-size: 12px;
    }

    .cv-preview {
        padding: 12px;
        min-height: 300px;
    }

    .preview-header-main h1 {
        font-size: 18px !important;
    }

    .preview-contact-row {
        font-size: 10px !important;
        gap: 2px;
    }

    .preview-section-title {
        font-size: 13px !important;
    }

    .education-item,
    .internship-item,
    .work-item,
    .organization-item,
    .project-item,
    .certification-item,
    .skill-category-item {
        padding: 12px;
    }

    .btn-add {
        padding: 10px;
        font-size: 13px;
    }

    .toast {
        font-size: 13px;
        padding: 12px 16px;
    }

    .preview-skill-tag {
        font-size: 10px !important;
        padding: 2px 8px;
    }

    .cert-preview {
        width: 80px;
        height: 80px;
    }

    .btn-upload-cert {
        font-size: 12px;
        padding: 6px 12px;
    }

    .btn-remove-cert-image {
        font-size: 11px;
        padding: 4px 10px;
    }
}

/* ============ LANDSCAPE MOBILE ============ */
@media (max-height: 600px) and (orientation: landscape) {
    .app-header {
        padding: 10px 0;
    }

    .welcome-screen {
        min-height: 60vh;
        padding: 20px 0;
    }

    .welcome-content h1 {
        font-size: 28px;
    }

    .welcome-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }

    .welcome-content p {
        font-size: 14px;
        margin-bottom: 16px;
    }

    .welcome-actions .btn-primary,
    .welcome-actions .btn-secondary {
        padding: 10px 20px;
        font-size: 14px;
    }

    .welcome-features {
        margin-top: 16px;
        gap: 16px;
    }

    .form-panel {
        max-height: 60vh;
    }

    .preview-panel {
        max-height: 60vh;
    }

    .cv-preview {
        min-height: 250px;
        padding: 12px;
    }

    .form-section {
        margin-bottom: 16px;
    }

    .section-title {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .form-group {
        margin-bottom: 10px;
    }

    .form-input,
    .form-textarea {
        padding: 8px 12px;
        font-size: 12px;
    }

    .education-item,
    .internship-item,
    .work-item,
    .organization-item,
    .project-item,
    .certification-item,
    .skill-category-item {
        padding: 10px;
        margin-bottom: 10px;
    }

    .btn-add {
        padding: 8px;
        font-size: 13px;
    }
}

/* ============ TABLET LANDSCAPE ============ */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    .cv-builder-layout {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .form-panel,
    .preview-panel {
        max-height: 70vh;
    }

    .form-panel {
        padding: 20px;
    }

    .preview-panel {
        padding: 20px;
    }
}

/* ============ LARGE SCREENS ============ */
@media (min-width: 1400px) {
    .container {
        max-width: 1600px;
        padding: 0 40px;
    }

    .cv-builder-layout {
        gap: 32px;
    }

    .form-panel,
    .preview-panel {
        padding: 32px;
    }

    .preview-header-main h1 {
        font-size: 32px !important;
    }

    .cv-preview {
        padding: 40px;
    }
}

/* ============ DARK THEME RESPONSIVE ============ */
@media (max-width: 768px) {

    body.dark-theme .btn-remove-edu,
    body.dark-theme .btn-remove-int,
    body.dark-theme .btn-remove-work,
    body.dark-theme .btn-remove-org,
    body.dark-theme .btn-remove-project,
    body.dark-theme .btn-remove-cert,
    body.dark-theme .btn-remove-skill {
        background: #450a0a;
        color: #fca5a5;
    }

    body.dark-theme .btn-remove-edu:hover,
    body.dark-theme .btn-remove-int:hover,
    body.dark-theme .btn-remove-work:hover,
    body.dark-theme .btn-remove-org:hover,
    body.dark-theme .btn-remove-project:hover,
    body.dark-theme .btn-remove-cert:hover,
    body.dark-theme .btn-remove-skill:hover {
        background: #7f1d1d;
    }

    body.dark-theme .education-item,
    body.dark-theme .internship-item,
    body.dark-theme .work-item,
    body.dark-theme .organization-item,
    body.dark-theme .project-item,
    body.dark-theme .certification-item,
    body.dark-theme .skill-category-item {
        border-color: #334155;
    }

    body.dark-theme .education-item:hover,
    body.dark-theme .internship-item:hover,
    body.dark-theme .work-item:hover,
    body.dark-theme .organization-item:hover,
    body.dark-theme .project-item:hover,
    body.dark-theme .certification-item:hover,
    body.dark-theme .skill-category-item:hover {
        border-color: #60a5fa;
    }

    body.dark-theme .cert-upload-area {
        border-color: #334155;
    }

    body.dark-theme .cert-preview {
        background: #1e293b;
        border-color: #334155;
    }
}

/* ============ PRINT RESPONSIVE ============ */
@media print and (max-width: 768px) {
    .cv-preview {
        padding: 12px !important;
    }

    .preview-header-main h1 {
        font-size: 20px !important;
    }

    .preview-contact-row {
        font-size: 11px !important;
    }

    .preview-section-title {
        font-size: 14px !important;
    }

    .preview-education-item .edu-institution,
    .preview-exp-item .exp-company {
        font-size: 13px !important;
    }
}
